<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增出库订单信息表')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-customerorder-add">
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">客户id：</label>
                <div class="col-sm-8">
                    <input name="cId" class="form-control" type="text" required>
                </div>
            </div>-->
            <div class="col-md-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户名称：</label>
                    <div class="col-sm-9">
                        <select class="form-control" id="khmc" name="cId">
                            <option>请选择</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">订单地址：</label>
                <div class="col-sm-8">
                    <input name="customerOrderAddress" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">下单时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="customerOrderStartDatetime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">期望到货时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="customerOrderExpectArrivalDatetime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    </div>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">商品id：</label>
                <div class="col-sm-8">
                    <input name="pId" class="form-control" type="text" required>
                </div>
            </div>-->
            <div class="col-md-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">商品名称：</label>
                    <div class="col-sm-9">
                        <select class="form-control" id="spmc" name="pId">
                            <option>请选择</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品数量：</label>
                <div class="col-sm-8">
                    <input name="customerOrderNumber" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group" style="visibility: hidden">
                <label class="col-sm-3 control-label" type="hidden">状态：</label>
                <div class="col-sm-8">
                    <input name="customerOrderState" class="form-control" type="text" required value="待出库" readonly>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "wms/customerorder"
        $("#form-customerorder-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-customerorder-add').serialize());
            }
        }

        $("input[name='customerOrderStartDatetime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='customerOrderExpectArrivalDatetime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $(function () {
            $.post("/wms/customer/list",function (result) {
                for (var i in result.rows) {
                    $("#khmc").append("<option value='"+result.rows[i].cId+"'>"+result.rows[i].cName+"</option>")
                }
            });
            $.post("/wms/product/list",function (result) {
                for (var i in result.rows) {
                    $("#spmc").append("<option value='"+result.rows[i].pId+"'>"+result.rows[i].pName+"</option>")
                }
            })
        });


    </script>
</body>
</html>